#include <stdio.h>

#define MAX_FILENAME_SIZE 256
#define ERROR_MSG_MAX_SIZE 20 + MAX_FILENAME_SIZE

long get_number_of_bytes(const char *fpath)
{
    FILE *f = fopen(fpath, "rb");
    if(!f)
    {
        char errormsg[ERROR_MSG_MAX_SIZE] = {0};
        sprintf(errormsg, "Could not open file %s", fpath);
        perror(errormsg);
        return -1;
    }
    //fseek(f, 0, SEEK_END);
    //long l = ftell(f);
    //fseek(f, 0, SEEK_SET);
    char c;
    long l = 0;
    for(; fread(&c, 1, sizeof(char), f); ++l);
    fclose(f);
    return l;
}
